/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package deti.es.ukni.persistence.entity;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author eurico
 */
@Entity
@Table(name = "BANDELEMENT")
@NamedQueries({@NamedQuery(name = "Bandelement.findAll", query = "SELECT b FROM Bandelement b"), @NamedQuery(name = "Bandelement.findByIdbandelement", query = "SELECT b FROM Bandelement b WHERE b.idbandelement = :idbandelement"), @NamedQuery(name = "Bandelement.findByName", query = "SELECT b FROM Bandelement b WHERE b.name = :name"), @NamedQuery(name = "Bandelement.findByRole", query = "SELECT b FROM Bandelement b WHERE b.role = :role")})
public class Bandelement implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "IDBANDELEMENT")
    private Integer idbandelement;
    @Basic(optional = false)
    @Column(name = "NAME")
    private String name;
    @Basic(optional = false)
    @Column(name = "ROLE")
    private String role;
    @Lob
    @Column(name = "BIOGRAPHY")
    private String biography;
    @JoinColumn(name = "REFIDBAND", referencedColumnName = "IDBAND")
    @ManyToOne(optional = false, fetch = FetchType.EAGER)
    private Band refidband;

    public Bandelement() {
    }

    public Bandelement(Integer idbandelement) {
        this.idbandelement = idbandelement;
    }

    public Bandelement(Integer idbandelement, String name, String role) {
        this.idbandelement = idbandelement;
        this.name = name;
        this.role = role;
    }

    public Integer getIdbandelement() {
        return idbandelement;
    }

    public void setIdbandelement(Integer idbandelement) {
        this.idbandelement = idbandelement;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getRole() {
        return role;
    }

    public void setRole(String role) {
        this.role = role;
    }

    public String getBiography() {
        return biography;
    }

    public void setBiography(String biography) {
        this.biography = biography;
    }

    public Band getRefidband() {
        return refidband;
    }

    public void setRefidband(Band refidband) {
        this.refidband = refidband;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idbandelement != null ? idbandelement.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Bandelement)) {
            return false;
        }
        Bandelement other = (Bandelement) object;
        if ((this.idbandelement == null && other.idbandelement != null) || (this.idbandelement != null && !this.idbandelement.equals(other.idbandelement))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "deti.es.ukni.persistence.entity.Bandelement[idbandelement=" + idbandelement + "]";
    }

}
